type #Range protected {
    a: Integer,
    b: Integer
};

function @validate: &(#Range) => Bool
    & {a, b} => (a <= b);

const Data1: String 'VerboseData01
{} :main:Range:
	a integer
		1
	b integer
		2';

const Data2: String 'VerboseData01
{} :main:Range:
	a integer
		3
	b integer
		2';

function describe-deserialized:
    &(String) => Async[unit,Error]
    &(data) =>
        \ await let range := { #Range@deserialize { encode data } },
        let { a, b } := range,
        \ await { sys::println { "(?, ?)" (a.{String}, b.{String}) } },
        { return () };

entry { crash-on-error
    { concat ([Data1,Data2] map describe-deserialized) }
        . { catch &(err) => { sys::println err.String } }
        . { wait-complete }
};


